#!/bin/bash

# postinst script for system-kernel-platform
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <postinst> \`configure' <most-recently-configured-version>
#        * <old-postinst> \`abort-upgrade' <new version>
#        * <conflictor's-postinst> \`abort-remove' \`in-favour' <package>
#          <new-version>
#        * <postinst> \`abort-remove'
#        * <deconfigured's-postinst> \`abort-deconfigure' \`in-favour'
#          <failed-install-package> <version> \`removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

PATH=/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

if [ "${BASEDIR:=/}" = "/" ]; then
    BASEDIR=""
else
    BASEDIR_OPT="-b $BASEDIR"
fi

case "$1" in
    configure)
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/kernel/drv/imc.conf ] && rm -f $BASEDIR/kernel/drv/imc.conf
	else
	    chmod 0644 "$BASEDIR/kernel/drv/imc.conf"
	    chown root:sys "$BASEDIR/kernel/drv/imc.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/acpippm.conf ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/acpippm.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86pc/kernel/drv/acpippm.conf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/acpippm.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd_iommu.conf ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd_iommu.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86pc/kernel/drv/amd_iommu.conf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd_iommu.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/pit_beep.conf ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/pit_beep.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86pc/kernel/drv/pit_beep.conf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/pit_beep.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/ppm.conf ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/ppm.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86pc/kernel/drv/ppm.conf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/ppm.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/rootnex.conf ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/rootnex.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86pc/kernel/drv/rootnex.conf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/rootnex.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/pit_beep.conf ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/pit_beep.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86xpv/kernel/drv/pit_beep.conf"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/pit_beep.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/xencons.conf ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/xencons.conf
	else
	    chmod 0644 "$BASEDIR/platform/i86xpv/kernel/drv/xencons.conf"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/xencons.conf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/kernel/drv/amd64/imc ] && rm -f $BASEDIR/kernel/drv/amd64/imc
	else
	    chmod 0755 "$BASEDIR/kernel/drv/amd64/imc"
	    chown root:sys "$BASEDIR/kernel/drv/amd64/imc"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/kernel/drv/amd64/imcstub ] && rm -f $BASEDIR/kernel/drv/amd64/imcstub
	else
	    chmod 0755 "$BASEDIR/kernel/drv/amd64/imcstub"
	    chown root:sys "$BASEDIR/kernel/drv/amd64/imcstub"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/amd64/unix ] && rm -f $BASEDIR/platform/i86pc/kernel/amd64/unix
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/amd64/unix"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/amd64/unix"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu.generic ] && rm -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu.generic
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu.generic"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu.generic"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD ] && rm -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15 ] && rm -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel ] && rm -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.46 ] && rm -f $BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.46
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.46"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.46"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/dacf/amd64/consconfig_dacf ] && rm -f $BASEDIR/platform/i86pc/kernel/dacf/amd64/consconfig_dacf
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/dacf/amd64/consconfig_dacf"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/dacf/amd64/consconfig_dacf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/acpinex ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/acpinex
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/acpinex"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/acpinex"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/acpippm ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/acpippm
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/acpippm"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/acpippm"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/amd_iommu ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/amd_iommu
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/amd_iommu"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/amd_iommu"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/cpudrv ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/cpudrv
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/cpudrv"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/cpudrv"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/isa ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/isa
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/isa"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/isa"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/npe ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/npe
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/npe"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/npe"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/pci ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/pci
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/pci"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/pci"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/pit_beep ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/pit_beep
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/pit_beep"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/pit_beep"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/ppm ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/ppm
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/ppm"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/ppm"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/drv/amd64/rootnex ] && rm -f $BASEDIR/platform/i86pc/kernel/drv/amd64/rootnex
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/drv/amd64/rootnex"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/drv/amd64/rootnex"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/mach/amd64/apix ] && rm -f $BASEDIR/platform/i86pc/kernel/mach/amd64/apix
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/mach/amd64/apix"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/mach/amd64/apix"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/mach/amd64/pcplusmp ] && rm -f $BASEDIR/platform/i86pc/kernel/mach/amd64/pcplusmp
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/mach/amd64/pcplusmp"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/mach/amd64/pcplusmp"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/mach/amd64/uppc ] && rm -f $BASEDIR/platform/i86pc/kernel/mach/amd64/uppc
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/mach/amd64/uppc"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/mach/amd64/uppc"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/misc/amd64/acpidev ] && rm -f $BASEDIR/platform/i86pc/kernel/misc/amd64/acpidev
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/misc/amd64/acpidev"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/misc/amd64/acpidev"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/misc/amd64/gfx_private ] && rm -f $BASEDIR/platform/i86pc/kernel/misc/amd64/gfx_private
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/misc/amd64/gfx_private"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/misc/amd64/gfx_private"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/kernel/misc/amd64/pci_prd ] && rm -f $BASEDIR/platform/i86pc/kernel/misc/amd64/pci_prd
	else
	    chmod 0755 "$BASEDIR/platform/i86pc/kernel/misc/amd64/pci_prd"
	    chown root:sys "$BASEDIR/platform/i86pc/kernel/misc/amd64/pci_prd"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/amd64/unix ] && rm -f $BASEDIR/platform/i86xpv/kernel/amd64/unix
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/amd64/unix"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/amd64/unix"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu.generic ] && rm -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu.generic
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu.generic"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu.generic"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD ] && rm -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15 ] && rm -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.GenuineIntel ] && rm -f $BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.GenuineIntel
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.GenuineIntel"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/cpu/amd64/cpu_ms.GenuineIntel"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/dacf/amd64/consconfig_dacf ] && rm -f $BASEDIR/platform/i86xpv/kernel/dacf/amd64/consconfig_dacf
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/dacf/amd64/consconfig_dacf"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/dacf/amd64/consconfig_dacf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/balloon ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/balloon
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/balloon"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/balloon"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/domcaps ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/domcaps
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/domcaps"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/domcaps"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/evtchn ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/evtchn
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/evtchn"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/evtchn"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/isa ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/isa
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/isa"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/isa"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/npe ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/npe
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/npe"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/npe"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/pci ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/pci
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/pci"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/pci"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/pit_beep ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/pit_beep
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/pit_beep"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/pit_beep"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/privcmd ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/privcmd
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/privcmd"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/privcmd"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/rootnex ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/rootnex
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/rootnex"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/rootnex"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xdb ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xdb
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xdb"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xdb"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xdf ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xdf
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xdf"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xdf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xenbus ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xenbus
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xenbus"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xenbus"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xencons ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xencons
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xencons"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xencons"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbe ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbe
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbe"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbe"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbo ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbo
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbo"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbo"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbu ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbu
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbu"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnbu"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnf ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xnf
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnf"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xnf"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvd ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvd
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvd"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvd"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvtap ] && rm -f $BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvtap
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvtap"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/drv/amd64/xpvtap"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_psm ] && rm -f $BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_psm
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_psm"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_psm"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_uppc ] && rm -f $BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_uppc
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_uppc"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/mach/amd64/xpv_uppc"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/gfx_private ] && rm -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/gfx_private
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/misc/amd64/gfx_private"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/misc/amd64/gfx_private"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/xnb ] && rm -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/xnb
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/misc/amd64/xnb"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/misc/amd64/xnb"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/xpv_autoconfig ] && rm -f $BASEDIR/platform/i86xpv/kernel/misc/amd64/xpv_autoconfig
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/misc/amd64/xpv_autoconfig"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/misc/amd64/xpv_autoconfig"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86xpv/kernel/tod/amd64/xpvtod ] && rm -f $BASEDIR/platform/i86xpv/kernel/tod/amd64/xpvtod
	else
	    chmod 0755 "$BASEDIR/platform/i86xpv/kernel/tod/amd64/xpvtod"
	    chown root:sys "$BASEDIR/platform/i86xpv/kernel/tod/amd64/xpvtod"
	fi
	[ "$ZONEINST" = "1" ] || (mkdir -p $BASEDIR/platform/i86pc/kernel/cpu/amd64 && cd $BASEDIR/platform/i86pc/kernel/cpu/amd64 && cp -f cpu_ms.GenuineIntel.6.46 cpu_ms.GenuineIntel.6.47)
	[ "$ZONEINST" = "1" ] || (grep -c "^pit_beep " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"SUNW,pit_beep"' pit_beep ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^acpinex " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"acpivirtnex"' acpinex ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^cpudrv " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"cpu"' cpudrv ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^amd_iommu " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"pci1002,5a23" "pci1022,11ff"' -m '* 0644 root sys' amd_iommu ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^imcstub " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"pci8086,e1e,p" "pci8086,e1f,p" "pci8086,e60,p" "pci8086,e68,p" "pci8086,e6a,p" "pci8086,e6b,p" "pci8086,e6c,p" "pci8086,e6d,p" "pci8086,e71,p" "pci8086,e79,p" "pci8086,ea0,p" "pci8086,ea8,p" "pci8086,eaa,p" "pci8086,eab,p" "pci8086,eac,p" "pci8086,ead,p" "pci8086,ec8,p" "pci8086,ec9,p" "pci8086,eca,p" "pci8086,2014,p" "pci8086,2016,p" "pci8086,2024,p" "pci8086,2040,p" "pci8086,2044,p" "pci8086,2048,p" "pci8086,2054,p" "pci8086,2055,p" "pci8086,2066,p" "pci8086,208e,p" "pci8086,2f1e,p" "pci8086,2f1f,p" "pci8086,2f28,p" "pci8086,2f60,p" "pci8086,2f68,p" "pci8086,2f6a,p" "pci8086,2f6b,p" "pci8086,2f6c,p" "pci8086,2f6d,p" "pci8086,2f71,p" "pci8086,2f79,p" "pci8086,2fa0,p" "pci8086,2fa8,p" "pci8086,2faa,p" "pci8086,2fab,p" "pci8086,2fac,p" "pci8086,2fad,p" "pci8086,2ffc,p" "pci8086,2ffd,p" "pci8086,3c71,p" "pci8086,3ca0,p" "pci8086,3ca8,p" "pci8086,3caa,p" "pci8086,3cab,p" "pci8086,3cac,p" "pci8086,3cad,p" "pci8086,3ce0,p" "pci8086,3ce3,p" "pci8086,3cf4,p" "pci8086,3cf5,p" "pci8086,3cf6,p" "pci8086,6f1e,p" "pci8086,6f1f,p" "pci8086,6f28,p" "pci8086,6f60,p" "pci8086,6f68,p" "pci8086,6f6a,p" "pci8086,6f6b,p" "pci8086,6f6c,p" "pci8086,6f6d,p" "pci8086,6f71,p" "pci8086,6f79,p" "pci8086,6fa0,p" "pci8086,6fa8,p" "pci8086,6faa,p" "pci8086,6fab,p" "pci8086,6fac,p" "pci8086,6fad,p" "pci8086,6ffc,p" "pci8086,6ffd,p" "pciex8086,e1e" "pciex8086,e1f" "pciex8086,e60" "pciex8086,e68" "pciex8086,e6a" "pciex8086,e6b" "pciex8086,e6c" "pciex8086,e6d" "pciex8086,e71" "pciex8086,e79" "pciex8086,ea0" "pciex8086,ea8" "pciex8086,eaa" "pciex8086,eab" "pciex8086,eac" "pciex8086,ead" "pciex8086,ec8" "pciex8086,ec9" "pciex8086,eca" "pciex8086,2014" "pciex8086,2016" "pciex8086,2024" "pciex8086,2040" "pciex8086,2044" "pciex8086,2048" "pciex8086,2054" "pciex8086,2055" "pciex8086,2066" "pciex8086,208e" "pciex8086,2f1e" "pciex8086,2f1f" "pciex8086,2f28" "pciex8086,2f60" "pciex8086,2f68" "pciex8086,2f6a" "pciex8086,2f6b" "pciex8086,2f6c" "pciex8086,2f6d" "pciex8086,2f71" "pciex8086,2f79" "pciex8086,2fa0" "pciex8086,2fa8" "pciex8086,2faa" "pciex8086,2fab" "pciex8086,2fac" "pciex8086,2fad" "pciex8086,2ffc" "pciex8086,2ffd" "pciex8086,3c71" "pciex8086,3ca0" "pciex8086,3ca8" "pciex8086,3caa" "pciex8086,3cab" "pciex8086,3cac" "pciex8086,3cad" "pciex8086,3ce0" "pciex8086,3ce3" "pciex8086,3cf4" "pciex8086,3cf5" "pciex8086,3cf6" "pciex8086,6f1e" "pciex8086,6f1f" "pciex8086,6f28" "pciex8086,6f60" "pciex8086,6f68" "pciex8086,6f6a" "pciex8086,6f6b" "pciex8086,6f6c" "pciex8086,6f6d" "pciex8086,6f71" "pciex8086,6f79" "pciex8086,6fa0" "pciex8086,6fa8" "pciex8086,6faa" "pciex8086,6fab" "pciex8086,6fac" "pciex8086,6fad" "pciex8086,6ffc" "pciex8086,6ffd"' imcstub ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^isa " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -c 'sysbus' -i '"pciclass,060100"' isa ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^npe " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"pciex_root_complex"' npe ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xnbo " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"xnb" "xnb,SUNW_mac"' xnbo ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xnbe " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"xnb,ioemu"' xnbe ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xnbu " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -i '"xnb,netfront"' xnbu ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^pci " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -c 'pci' pci ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^acpippm " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  acpippm ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^balloon " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0444 root sys' balloon ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^domcaps " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0444 root sys' domcaps ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^evtchn " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0666 root sys' evtchn ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^imc " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  imc ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^ppm " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  ppm ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^privcmd " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0666 root sys' privcmd ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^rootnex " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  rootnex ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xdb " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  xdb ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xdf " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  xdf ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xenbus " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0666 root sys' xenbus ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xencons " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  xencons ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xnf " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  xnf ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xpvd " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  xpvd ) )
	[ "$ZONEINST" = "1" ] || (grep -c "^xpvtap " $BASEDIR/etc/name_to_major >/dev/null || ( add_drv -n  $BASEDIR_OPT  -m '* 0666 root sys' xpvtap ) )
	
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac



# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

